<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 联系人</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="__PUBLIC__/admin/favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/laydate/laydate.css" rel="stylesheet">
</head>
<include file="Admin@Index:cache"/>
<body class="gray-bg contacts" oncopy="copyval()">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-content">
                    <h5>用户列表-
                        <small>所有用户</small>
                    </h5>
                    <div class="col-sm-12" style="margin-bottom: 1rem">
                        <form role="form" id="my_form" action="__MODULE__/User/user_list" method="get">
                            <div class="form-group">
                                <input type="text" id="content" placeholder="" name="key" class="form-control"
                                       value="<{$search.key}>">
                            </div>
                            <div>
                                <input style="height: 2.5rem;width: 200px" class="laydate-icon" placeholder="起始时间" id="start"
                                       name="start" value="<{$search.start}>">
                                <input style="height: 2.5rem;width: 200px" class="laydate-icon" placeholder="截止时间" id="end"
                                       name="end" value="<{$search.end}>">
                                <select class="form-control m-b" name="cert_status"
                                        style="margin-bottom: 0;padding-top: 3px;display: inline;width: 11%;">
                                    <option value="">基础认证</option>
                                    <option value="1"
                                    <if condition="$_GET['cert_status'] eq 1">selected</if>
                                    >未认证</option>
                                    <option value="2"
                                    <if condition="$_GET['cert_status'] eq 2">selected</if>
                                    >已通过</option>
                                    <option value="3"
                                    <if condition="$_GET['cert_status'] eq 3">selected</if>
                                    >认证拒绝</option>
                                    <option value="4"
                                    <if condition="$_GET['cert_status'] eq 4">selected</if>
                                    >其他认证中</option>
                                    <option value="5"
                                    <if condition="$_GET['cert_status'] eq 5">selected</if>
                                    >审核中</option>
                                </select>


                                <select class="form-control m-b" name="check_type"
                                        style="margin-bottom: 0;padding-top: 3px;display: inline;width: 11%;">
                                    <option value="">审核类型</option>
                                    <option value="1"
                                    <if condition="$_GET['check_type'] eq 1">selected</if>
                                    >未操作</option>
                                    <option value="2"
                                    <if condition="$_GET['check_type'] eq 2">selected</if>
                                    >机器审核</option>
                                    <option value="3"
                                    <if condition="$_GET['check_type'] eq 3">selected</if>
                                    >人工审核</option>
                                </select>

                                <!--<select class="form-control m-b" name="channel" id="select_channel"-->
                                        <!--style="margin-bottom: 0;padding-top: 3px;display: inline;width: 11%;">-->
                                    <!--<option value="">渠道商</option>-->
                                    <!--<option value="99">自增</option>-->

                                    <!--<volist name="channel" id="vo">-->
                                        <!--<option value="<{$vo.chan_id}>"><{$vo.channel_name}></option>-->
                                    <!--</volist>-->
                                <!--</select>-->
                                <span>每页显示</span>
                                <select onchange="submit_form()" class="form-control m-b" name="show_num"  id="show_num" style="margin-bottom: 0;padding-top: 3px;display: inline;width: 11%;" >
                                    <option value="10">10</option>
                                    <option value="20">20</option>
                                    <option value="50">50</option>
                                    <option value="100">100</option>
                                </select>
                                <span>条</span>
                                <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit" id="search">
                                    <strong>搜索</strong>
                                </button>
                            </div>

                        </form>
                        <!--<div class="" style="width:12%;margin-top:1rem">-->
                        <!--<form method="post" enctype="multipart/form-data" action="__MODULE__/User/hx_import_data" onsubmit="return check()">-->
                        <!--<input type="file" name="data" id="data" style="display:none"><label style="" class="btn btn-default" href="javascript:void(0);" for="data" >数据导入</label><input type="submit" class="btn btn-info" id="sub"  value="提交"></form>-->
                        <!--</div>-->
                    </div>
                    <br>
                    <div class="ibox-content">
                        <table class="table table-striped table-hover" id="sample-table">
                            <tbody>
                            <tr>
                                <th>ID</th>
                                <th>用户手机号</th>
                                <th>用户姓名</th>
                                <th>认证状态</th>
                                <th>是否黑名单</th>
                                <!--<th>身份证号</th>-->
                                <th>注册日期</th>
                                <th>认证时间</th>
                                <th>授信额度</th>
                                <th>当前余额</th>
                                <th class="client-status">操作</th>
                            </tr>
                            <volist name="data" id="vo">
                                <tr>
                                    <td><{$vo.id}></td>
                                    <td><{$vo.mobile}></td>
                                    <td><{$vo.username}></td>
                                    <td><{$vo.cert_status}></td>
                                    <td><{$vo.black_status}></td>
                                    <td><{$vo.ctime}></td>
                                    <td><{$vo.cert_time}></td>
                                    <td><{$vo.quota}></td>
                                    <td><{$vo.balance}></td>
                                    <td class="client-status">
                                           <!--<a class="btn btn-success btn-rounded y" href="javascript:;"-->
                                            <!--onclick="into_detail('<{$vo.id}>')">详情</a>-->
                                            <if condition="$vo.status eq 1">
                                                <a class="btn btn-danger btn-rounded" href="javascript:;"
                                                   onclick="put_black('<{$vo.id}>',1)">拉黑</a>
                                                <else/>
                                                <a class="btn btn-danger btn-rounded" href="javascript:;"
                                                   onclick="put_black('<{$vo.id}>',2)">解除拉黑</a>
                                            </if>
                                    </td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                    </div>
                    <ul class="pagination">
                            <{$fpage}>
                    </ul>

                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/admin/js/layer/layer.js"></script>

<script src="__PUBLIC__/admin/js/layui/layui.js"></script>

<script src="__PUBLIC__/admin/js/layui/lay/modules/laydate.js"></script>
<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>


<script>



    function submit_form() {
        var form = document.getElementById('my_form');
        form.submit();
    }

    //select赋值
    var option2="<{$search.show_num}>";
    $('#show_num').val(option2);

    //select赋值
    var option = "<{$search.channel}>";
    var rid = "<{$rid}>";
    $('#select_channel').val(option);



    function into_detail(id) {
        window.location.href = '__MODULE__/User/user_detail?u_id=' + id;
        layer.load(4);
        $.post('__MODULE__/User/user_detail', {u_id: id}, function (data) {
            layer.closeAll('loading');
        });
    }

          //拉黑操作 type 1 拉黑  2解除拉黑
        function put_black(u_id,type){

            html='';
            html+='<div class="modal-body" id="lists" style="height:80%">';
            html+='<form class="form-horizontal">';

            html+='<div class="form-group">';
            html+='<div class="col-sm-12">';
            html+='<textarea id="reason" type="text" placeholder="输入拉黑/解除拉黑原因" class="form-control"></textarea> ';
            html+='</div>';
            html+='</div>';

            html+='</form>';
            html+='<div class="modal-footer" style="border:0">';
            html+='<a href="javascript:void(0);" onclick="layer.closeAll()" type="button" class="btn btn-default" >关闭</a>';
            html+='<a href="javascript:void(0);" onclick="black_sure(\''+u_id+'\',\''+type+'\');" type="button" class="btn btn-primary" >提交</a>';
            html+='</div>';
            html+='</div>';

            layer.open({
                type: 1, //Page层类型
                area: ['400px', '230px'],
                title: '拉黑操作',
                shade: 0.6, //遮罩透明度
                maxmin: true, //允许全屏最小化
                anim: 1, //0-6的动画形式，-1不开启
                content: html
            });
        }

       //确定 1 拉黑  2解除拉黑
        function black_sure(id,type){

            console.log('iiii',id);
            console.log('ttt',type);

            var reason=$('#reason').val();
            if(reason==''){
                layer.msg('原因不能为空', {time: 2000, icon: 5});
                return false;
            }
            if(type=='1'){
                var content='确定拉黑';
            }else if(type=='2'){
                var content='确定解除拉黑';
            }

            layer.confirm(content,function(){

                layer.load(2);
                $.post('__MODULE__/User/pull_black', {type: type, id: id,reason:reason}, function (data) {
                    console.log('dddd',data);
                    layer.closeAll('loading');
                    if (data.code == '1001') {
                        window.location.reload();
                    } else {
                        if (data.status == '0') {
                            layer.msg(data.info, {time: 2000, icon: 5});
                        } else {
                            layer.msg(data.result, {time: 2000, icon: 5});
                        }
                    }
                });
            });
        }
    //
    //
    //
    //    function lock_user(vid,status){
    //        layer.confirm('是否确定锁定/解锁',function(){
    //            layer.load(2);
    //            $.post('__MODULE__/User/lock_user', {vid: vid, status: status}, function (data) {
    //                layer.closeAll('loading');
    //                if (data.code == '1001') {
    //                    window.location.reload();
    //                } else {
    //                    if (data.status == '0') {
    //                        layer.msg(data.info, {time: 2000, icon: 5});
    //                    } else {
    //                        layer.msg(data.result, {time: 2000, icon: 5});
    //                    }
    //                }
    //            });
    //        });
    //    }



    layui.use('laydate', function () {
        var laydate = layui.laydate;
        var start = {
            choose: function (dates) {
                end.min = dates; //开始日选好后，重置结束日的最小日期
                end.start = dates; //将结束日的初始值设定为开始日
            }
        };
        var end = {
            choose: function (dates) {
                start.max = dates; //结束日选好后，重置开始日的最大日期

            }
        };

        document.getElementById('start').onclick = function () {
            start.elem = this;
            laydate(start);
        }
        document.getElementById('end').onclick = function () {
            end.elem = this;
            laydate(end);
        }
    });


    function copyval() {
//        event.returnValue = false;
        var content = '【所有用户】列表复制：'+window.getSelection().toString();
        $.post('__MODULE__/Mypublic/copy_all', {content:content}, function (data) {
            if (data.code == '1001') {
            } else {
                console.log(data);
            }
        });
//        console.log(content)
    }
</script>


</body>

</html>
